// pages/my/my.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;

    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight,
          userInfo: wx.getStorageSync('userInfo')
        })
      }
    })
  },
  onShow:function(){
    var that=this;
    clearTimeout();
    setTimeout(function(){
      getBalance(that);
    },800)
  },
  toLogs:function(e){
    wx.navigateTo({
      url: '../../pages/logs/logs?id='+e.target.id,
    })
  },
  toWithdraw:function(){
    wx.navigateTo({
      url: '../../pages/withdraw/withdraw',
    })
  },
  toTransactionDetail:function(){
    wx.navigateTo({
      url: '../../pages/transactionDetail/transactionDetail',
    })
  },
  toConmonQuestion:function(){
    wx.navigateTo({
      url: '../../pages/conmonQuestion/conmonQuestion',
    })
  }
})

function getBalance(that){
  wx.request({
    url: app.globalData.allUrl + "/api/my_money.php",
    data: {
      user_id: wx.getStorageSync('userid'),

    },
    header: { 'content-type': "application/x-www-form-urlencoded" },
    method: 'POST',
    success: function (res) {
     console.log(res.data)
      that.setData({
        banlace:res.data.data
      })
    }, fail: function () {
    }
  })
}